package com.lsh.oms.consumer.bootstrap;

import com.lsh.oms.api.model.es.OrderHeadForEs;
import com.lsh.oms.api.service.es.EsSyncInterface;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by panxudong on 16/11/9.
 */
public class Bootstrap {

    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/*.xml");
        context.start();
        EsSyncInterface esSyncInterface = context.getBean(EsSyncInterface.class);

//        List<OrderHeadForEs> list = new ArrayList<>();

        long i=1;
        while(i<10) {
            OrderHeadForEs orderHeadForEs = new OrderHeadForEs();
            orderHeadForEs.setOrderCode(i);
            orderHeadForEs.setAddressCode(i * 100);
            orderHeadForEs.setOrderStatus(20);
            orderHeadForEs.setMarketName(i + "尚熙超市");
            try {
                esSyncInterface.createIndex(orderHeadForEs);
            }catch(Exception e) {

            }
            Thread.sleep(1000);
            i++;
        }

    }
}
